package com.springbootbase.springbootproject.service.impl;

import com.springbootbase.springbootproject.mapper.evaluationMapper;
import com.springbootbase.springbootproject.pojo.Evaluation;
import com.springbootbase.springbootproject.service.evaluationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.time.LocalDate;
import java.util.ArrayList;


@Service
public class evaluationServiceImpl implements evaluationService {

    @Autowired
    private evaluationMapper evaluationMapper;

    @Override
    public void addComment(Evaluation evaluation) {
        evaluation.setCreatedAt(LocalDate.now());
        evaluationMapper.addComment(evaluation);
    }

    @Override
    public ArrayList<Evaluation> getComment(String username) {
       ArrayList<Evaluation> evaluationArrayList = evaluationMapper.getList(username);
       return evaluationArrayList;
    }
}
